<template>
	<view class="geek-goods-item">
		<view class="img" v-if="showThumb">
			<u-image :src="thumb" mode="widthFix" width="240rpx" height="180rpx"></u-image>
		</view>

		<view class="info">
			<view class="title">
				{{title}}
			</view>

			<view class="flex align-center justify-between">
				<view class="dlbox">
					<view class="dt">
						单价：
					</view>
					<view class="dd">
						<up-text mode="name" :text="price" color="#3c9cff" bold></up-text>
					</view>
				</view>
				
				<view class="dlbox">
					<view class="dt">
						数量：
					</view>
					<view class="dd">
						<up-text :text="total" color="#e45656" size="14" bold></up-text>
						<text>{{unit}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import _ from 'lodash'
	export default {
		props: {
			item: {
				type: Object,
				default () {
					return {}
				}
			},
			showThumb: {
				type: Boolean,
				default: false
			}
		},

		computed: {
			title() {
				return this.item?.title || ''
			},

			thumb() {
				return this.item?.image || ''
			},

			total() {
				return this.item?.total / 100 || 0
			},

			unit() {
				return this.item?.unit || ''
			},

			price() {
				return Number(this.item?.price) || 0
			}
		}
	}
</script>

<style lang="scss" scoped>
	.geek-goods-item {
		display: flex;
		align-items: center;
		border-bottom: 1px solid #f0f0f0;
		padding: 28rpx 16rpx;

		&:last-child {
			border-bottom: none;
			padding-bottom: 0;
		}

		.img {
			width: 200rpx;
			height: 150rpx;
			overflow: hidden;
			margin-right: 24rpx;
		}

		.info {
			flex: 1;
			overflow: hidden;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			min-height: 150rpx;

			.title {
				font-size: 28rpx;
				color: #232323;
				line-height: 40rpx;
				margin-bottom: 10rpx;
				display: flex;
				align-items: center;

				view+view {
					margin-left: 6rpx;
				}
			}

			.dlbox {
				display: flex;
				align-items: center;
				font-size: 24rpx;
				margin-top: 10rpx;

				.dt {
					white-space: nowrap;
					color: #999;
					font-size: 26rpx;
				}

				.dd {
					color: #333;
					display: flex;
					align-items: center;
					
					&>text{
						margin-left: 6rpx;
					}
				}
			}
		}
	}
</style>